.class public final Lcom/google/android/exoplayer/audio/AudioTrack;
.super Ljava/lang/Object;
.source "AudioTrack.java"


# annotations
.annotation build Landroid/annotation/TargetApi;
    value = 0x10
.end annotation

.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/google/android/exoplayer/audio/AudioTrack$e;,
        Lcom/google/android/exoplayer/audio/AudioTrack$d;,
        Lcom/google/android/exoplayer/audio/AudioTrack$c;,
        Lcom/google/android/exoplayer/audio/AudioTrack$InvalidAudioTrackTimestampException;,
        Lcom/google/android/exoplayer/audio/AudioTrack$WriteException;,
        Lcom/google/android/exoplayer/audio/AudioTrack$InitializationException;
    }
.end annotation


# static fields
.field public static S:Z

.field public static T:Z


# instance fields
.field private A:I

.field private B:I

.field private C:J

.field private D:J

.field private E:J

.field private F:F

.field private G:[B

.field private H:I

.field private I:I

.field private J:Ljava/nio/ByteBuffer;

.field private K:Ljava/nio/ByteBuffer;

.field private L:I

.field private M:Ljava/nio/ByteBuffer;

.field private N:Lcom/google/android/exoplayer/audio/c;

.field private O:Ljava/nio/ByteBuffer;

.field private P:I

.field private Q:F

.field private R:F

.field private final a:Lcom/google/android/exoplayer/audio/a;

.field private final b:I

.field private final c:Landroid/os/ConditionVariable;

.field private final d:[J

.field private final e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

.field private f:Landroid/media/AudioTrack;

.field private g:Landroid/media/AudioTrack;

.field private h:I

.field private i:I

.field private j:I

.field private k:I

.field private l:Z

.field private m:I

.field private n:I

.field private o:J

.field private p:I

.field private q:I

.field private r:J

.field private s:J

.field private t:Z

.field private u:J

.field private v:Ljava/lang/reflect/Method;

.field private w:J

.field private x:J

.field private y:J

.field private z:J


# direct methods
.method static constructor <clinit>()V
    .locals 0

    return-void
.end method

.method public constructor <init>(Lcom/google/android/exoplayer/audio/a;I)V
    .locals 2

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, -0x1

    .line 2
    iput v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->L:I

    const/high16 v0, 0x3f800000    # 1.0f

    .line 3
    iput v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->Q:F

    .line 4
    iput v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->R:F

    .line 5
    iput-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->a:Lcom/google/android/exoplayer/audio/a;

    .line 6
    iput p2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->b:I

    .line 7
    new-instance p1, Landroid/os/ConditionVariable;

    const/4 p2, 0x1

    invoke-direct {p1, p2}, Landroid/os/ConditionVariable;-><init>(Z)V

    iput-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->c:Landroid/os/ConditionVariable;

    .line 8
    sget p1, Lcom/google/android/exoplayer/util/o;->a:I

    const/4 p2, 0x0

    const/16 v1, 0x12

    if-lt p1, v1, :cond_0

    .line 9
    :try_start_0
    const-class p1, Landroid/media/AudioTrack;

    const-string v1, "getLatency"

    .line 10
    invoke-virtual {p1, v1, p2}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;

    move-result-object p1

    iput-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->v:Ljava/lang/reflect/Method;
    :try_end_0
    .catch Ljava/lang/NoSuchMethodException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    nop

    .line 11
    :cond_0
    :goto_0
    sget p1, Lcom/google/android/exoplayer/util/o;->a:I

    const/16 v1, 0x17

    if-lt p1, v1, :cond_1

    .line 12
    new-instance p1, Lcom/google/android/exoplayer/audio/AudioTrack$e;

    invoke-direct {p1}, Lcom/google/android/exoplayer/audio/AudioTrack$e;-><init>()V

    iput-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    goto :goto_1

    :cond_1
    const/16 v1, 0x13

    if-lt p1, v1, :cond_2

    .line 13
    new-instance p1, Lcom/google/android/exoplayer/audio/AudioTrack$d;

    invoke-direct {p1}, Lcom/google/android/exoplayer/audio/AudioTrack$d;-><init>()V

    iput-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    goto :goto_1

    .line 14
    :cond_2
    new-instance p1, Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-direct {p1, p2}, Lcom/google/android/exoplayer/audio/AudioTrack$c;-><init>(Lcom/google/android/exoplayer/audio/AudioTrack$a;)V

    iput-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    :goto_1
    const/16 p1, 0xa

    new-array p1, p1, [J

    .line 15
    iput-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->d:[J

    .line 16
    iput v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->F:F

    const/4 p1, 0x0

    .line 17
    iput p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->B:I

    return-void
.end method

.method private static a(ILjava/nio/ByteBuffer;)I
    .locals 2

    const/4 v0, 0x7

    if-eq p0, v0, :cond_3

    const/16 v0, 0x8

    if-ne p0, v0, :cond_0

    goto :goto_0

    :cond_0
    const/4 v0, 0x5

    if-ne p0, v0, :cond_1

    .line 156
    invoke-static {}, Lcom/google/android/exoplayer/util/a;->a()I

    move-result p0

    return p0

    :cond_1
    const/4 v0, 0x6

    if-ne p0, v0, :cond_2

    .line 157
    invoke-static {p1}, Lcom/google/android/exoplayer/util/a;->a(Ljava/nio/ByteBuffer;)I

    move-result p0

    return p0

    .line 158
    :cond_2
    new-instance p1, Ljava/lang/IllegalStateException;

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Unexpected audio encoding: "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p0

    invoke-direct {p1, p0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw p1

    .line 159
    :cond_3
    :goto_0
    invoke-static {p1}, Lcom/google/android/exoplayer/util/d;->a(Ljava/nio/ByteBuffer;)I

    move-result p0

    return p0
.end method

.method private static a(Landroid/media/AudioTrack;Ljava/nio/ByteBuffer;I)I
    .locals 1
    .annotation build Landroid/annotation/TargetApi;
        value = 0x15
    .end annotation

    const/4 v0, 0x1

    .line 135
    invoke-virtual {p0, p1, p2, v0}, Landroid/media/AudioTrack;->write(Ljava/nio/ByteBuffer;II)I

    move-result p0

    return p0
.end method

.method private a(Ljava/nio/ByteBuffer;)I
    .locals 6

    .line 67
    invoke-direct {p0, p1}, Lcom/google/android/exoplayer/audio/AudioTrack;->b(Ljava/nio/ByteBuffer;)I

    move-result v0

    .line 68
    iget-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->N:Lcom/google/android/exoplayer/audio/c;

    if-nez v1, :cond_1

    .line 69
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    invoke-virtual {v0}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;

    .line 70
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    invoke-static {p1, v0}, Lcom/google/android/exoplayer/audio/b;->a(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)Z

    move-result p1

    if-nez p1, :cond_0

    .line 71
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->flip()Ljava/nio/Buffer;

    .line 72
    :cond_0
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I

    move-result p1

    return p1

    .line 73
    :cond_1
    iget v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->L:I

    const/4 v2, 0x0

    if-ne v0, v1, :cond_3

    iget-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    .line 74
    invoke-static {p1, v1}, Lcom/google/android/exoplayer/audio/b;->a(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)Z

    move-result p1

    if-eqz p1, :cond_2

    goto :goto_0

    :cond_2
    return v2

    .line 75
    :cond_3
    :goto_0
    iget p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->L:I

    if-eq v0, p1, :cond_5

    .line 76
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->position()I

    move-result p1

    if-lez p1, :cond_4

    .line 77
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->flip()Ljava/nio/Buffer;

    goto :goto_1

    :cond_4
    return v2

    .line 78
    :cond_5
    :goto_1
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->N:Lcom/google/android/exoplayer/audio/c;

    iget-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    iget-object v3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    invoke-virtual {v1}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v4

    iget v5, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->L:I

    if-eq v0, v5, :cond_6

    const/4 v2, 0x1

    :cond_6
    invoke-virtual {p1, v1, v3, v4, v2}, Lcom/google/android/exoplayer/audio/c;->a(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;IZ)I

    .line 79
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;

    .line 80
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I

    move-result p1

    return p1
.end method

.method private a(J)J
    .locals 2

    .line 155
    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->h:I

    int-to-long v0, v0

    mul-long p1, p1, v0

    const-wide/32 v0, 0xf4240

    div-long/2addr p1, v0

    return-wide p1
.end method

.method static synthetic a(Lcom/google/android/exoplayer/audio/AudioTrack;)Landroid/os/ConditionVariable;
    .locals 0

    .line 1
    iget-object p0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->c:Landroid/os/ConditionVariable;

    return-object p0
.end method

.method private a(II)V
    .locals 5

    .line 143
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->J:Ljava/nio/ByteBuffer;

    .line 144
    invoke-virtual {v0}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v1

    .line 145
    new-instance v2, Lcom/google/android/exoplayer/audio/c;

    iget v3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->j:I

    mul-int/lit16 v4, v3, 0x2000

    invoke-direct {v2, p1, p2, v3, v4}, Lcom/google/android/exoplayer/audio/c;-><init>(IIII)V

    .line 146
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    invoke-static {p1, v1}, Lcom/google/android/exoplayer/audio/b;->a(Ljava/nio/ByteBuffer;I)Ljava/nio/ByteBuffer;

    move-result-object p1

    iput-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    .line 147
    invoke-virtual {p1, v0}, Ljava/nio/ByteBuffer;->put(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;

    .line 148
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->flip()Ljava/nio/Buffer;

    .line 149
    invoke-virtual {v2, v1}, Lcom/google/android/exoplayer/audio/c;->a(I)I

    move-result p1

    .line 150
    iget-object p2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    invoke-static {p2, p1}, Lcom/google/android/exoplayer/audio/b;->a(Ljava/nio/ByteBuffer;I)Ljava/nio/ByteBuffer;

    move-result-object p1

    iput-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    .line 151
    iget-object p2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    invoke-virtual {p2}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v0

    const/4 v1, 0x1

    invoke-virtual {v2, p2, p1, v0, v1}, Lcom/google/android/exoplayer/audio/c;->a(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;IZ)I

    .line 152
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;

    .line 153
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I

    move-result p2

    const/4 v0, 0x0

    invoke-direct {p0, p1, v0, p2}, Lcom/google/android/exoplayer/audio/AudioTrack;->a(Ljava/nio/ByteBuffer;II)V

    return-void
.end method

.method private static a(Landroid/media/AudioTrack;F)V
    .locals 0
    .annotation build Landroid/annotation/TargetApi;
        value = 0x15
    .end annotation

    .line 154
    invoke-virtual {p0, p1}, Landroid/media/AudioTrack;->setVolume(F)I

    return-void
.end method

.method private a(Ljava/nio/ByteBuffer;II)V
    .locals 10

    .line 60
    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->F:F

    invoke-static {}, Landroid/media/AudioTrack;->getMaxVolume()F

    move-result v1

    cmpl-float v0, v0, v1

    if-lez v0, :cond_2

    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->F:F

    const/high16 v1, 0x3f800000    # 1.0f

    cmpl-float v0, v0, v1

    if-eqz v0, :cond_2

    .line 61
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-virtual {v0}, Landroid/media/AudioTrack;->getAudioFormat()I

    move-result v0

    const/4 v2, 0x2

    if-eq v0, v2, :cond_0

    const/4 v3, 0x3

    if-ne v0, v3, :cond_2

    .line 62
    :cond_0
    iget-object v3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->K:Ljava/nio/ByteBuffer;

    invoke-static {v3, p3}, Lcom/google/android/exoplayer/audio/b;->a(Ljava/nio/ByteBuffer;I)Ljava/nio/ByteBuffer;

    move-result-object v5

    iput-object v5, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->K:Ljava/nio/ByteBuffer;

    .line 63
    iput-object v5, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->J:Ljava/nio/ByteBuffer;

    .line 64
    iget v6, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->F:F

    if-ne v0, v2, :cond_1

    const/16 v0, 0x10

    const/16 v9, 0x10

    goto :goto_0

    :cond_1
    const/16 v0, 0x8

    const/16 v9, 0x8

    :goto_0
    move-object v4, p1

    move v7, p2

    move v8, p3

    invoke-static/range {v4 .. v9}, Lcom/google/android/exoplayer/audio/b;->a(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;FIII)V

    .line 65
    invoke-direct {p0, v1}, Lcom/google/android/exoplayer/audio/AudioTrack;->c(F)V

    return-void

    .line 66
    :cond_2
    iput-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->J:Ljava/nio/ByteBuffer;

    return-void
.end method

.method private static b(Ljava/lang/String;)I
    .locals 5

    .line 21
    invoke-virtual {p0}, Ljava/lang/String;->hashCode()I

    move-result v0

    const/4 v1, 0x0

    const/4 v2, 0x3

    const/4 v3, 0x2

    const/4 v4, 0x1

    sparse-switch v0, :sswitch_data_0

    goto :goto_0

    :sswitch_0
    const-string v0, "audio/vnd.dts.hd"

    invoke-virtual {p0, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p0

    if-eqz p0, :cond_0

    const/4 p0, 0x3

    goto :goto_1

    :sswitch_1
    const-string v0, "audio/eac3"

    invoke-virtual {p0, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p0

    if-eqz p0, :cond_0

    const/4 p0, 0x1

    goto :goto_1

    :sswitch_2
    const-string v0, "audio/ac3"

    invoke-virtual {p0, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p0

    if-eqz p0, :cond_0

    const/4 p0, 0x0

    goto :goto_1

    :sswitch_3
    const-string v0, "audio/vnd.dts"

    invoke-virtual {p0, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p0

    if-eqz p0, :cond_0

    const/4 p0, 0x2

    goto :goto_1

    :cond_0
    :goto_0
    const/4 p0, -0x1

    :goto_1
    if-eqz p0, :cond_4

    if-eq p0, v4, :cond_3

    if-eq p0, v3, :cond_2

    if-eq p0, v2, :cond_1

    return v1

    :cond_1
    const/16 p0, 0x8

    return p0

    :cond_2
    const/4 p0, 0x7

    return p0

    :cond_3
    const/4 p0, 0x6

    return p0

    :cond_4
    const/4 p0, 0x5

    return p0

    nop

    :sswitch_data_0
    .sparse-switch
        -0x41455b98 -> :sswitch_3
        0xb269698 -> :sswitch_2
        0x59ae0c65 -> :sswitch_1
        0x59c2dc42 -> :sswitch_0
    .end sparse-switch
.end method

.method private b(Ljava/nio/ByteBuffer;)I
    .locals 4

    .line 2
    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->h:I

    int-to-float v0, v0

    iget v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->R:F

    div-float/2addr v0, v1

    float-to-int v0, v0

    .line 3
    iget v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->L:I

    if-eq v1, v0, :cond_2

    iget-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    if-eqz v1, :cond_0

    .line 4
    invoke-virtual {v1}, Ljava/nio/ByteBuffer;->position()I

    move-result v1

    if-nez v1, :cond_2

    .line 5
    :cond_0
    iget v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->h:I

    if-eq v1, v0, :cond_1

    .line 6
    iget p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->j:I

    mul-int/lit16 p1, p1, 0x2000

    .line 7
    new-instance v1, Lcom/google/android/exoplayer/audio/c;

    iget v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->h:I

    iget v3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->j:I

    invoke-direct {v1, v2, v0, v3, p1}, Lcom/google/android/exoplayer/audio/c;-><init>(IIII)V

    iput-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->N:Lcom/google/android/exoplayer/audio/c;

    .line 8
    iget-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    invoke-static {v1, p1}, Lcom/google/android/exoplayer/audio/b;->a(Ljava/nio/ByteBuffer;I)Ljava/nio/ByteBuffer;

    move-result-object v1

    iput-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    .line 9
    iget-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->N:Lcom/google/android/exoplayer/audio/c;

    invoke-virtual {v1, p1}, Lcom/google/android/exoplayer/audio/c;->a(I)I

    move-result p1

    .line 10
    iget-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    invoke-static {v1, p1}, Lcom/google/android/exoplayer/audio/b;->a(Ljava/nio/ByteBuffer;I)Ljava/nio/ByteBuffer;

    move-result-object p1

    iput-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    goto :goto_0

    :cond_1
    const/4 v1, 0x0

    .line 11
    iput-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->N:Lcom/google/android/exoplayer/audio/c;

    .line 12
    iget-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->capacity()I

    move-result p1

    invoke-static {v1, p1}, Lcom/google/android/exoplayer/audio/b;->a(Ljava/nio/ByteBuffer;I)Ljava/nio/ByteBuffer;

    move-result-object p1

    iput-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    .line 13
    :goto_0
    iput v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->L:I

    .line 14
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {p1}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->h()Z

    .line 15
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    iget v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->R:F

    invoke-virtual {p1, v1}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->b(F)V

    :cond_2
    return v0
.end method

.method private b(J)J
    .locals 2

    const-wide/32 v0, 0xf4240

    mul-long p1, p1, v0

    .line 20
    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->h:I

    int-to-long v0, v0

    div-long/2addr p1, v0

    return-wide p1
.end method

.method private static b(Landroid/media/AudioTrack;F)V
    .locals 0

    .line 19
    invoke-virtual {p0, p1, p1}, Landroid/media/AudioTrack;->setStereoVolume(FF)I

    return-void
.end method

.method private c(J)J
    .locals 2

    .line 8
    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->m:I

    int-to-long v0, v0

    div-long/2addr p1, v0

    return-wide p1
.end method

.method private c(F)V
    .locals 2

    .line 3
    invoke-virtual {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->g()Z

    move-result v0

    if-nez v0, :cond_0

    const-string p1, "AudioTrack"

    const-string v0, "setAudioTrackVolume isInitialized"

    .line 4
    invoke-static {p1, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 5
    :cond_0
    sget v0, Lcom/google/android/exoplayer/util/o;->a:I

    const/16 v1, 0x15

    if-lt v0, v1, :cond_1

    .line 6
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-static {v0, p1}, Lcom/google/android/exoplayer/audio/AudioTrack;->a(Landroid/media/AudioTrack;F)V

    goto :goto_0

    .line 7
    :cond_1
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-static {v0, p1}, Lcom/google/android/exoplayer/audio/AudioTrack;->b(Landroid/media/AudioTrack;F)V

    :goto_0
    return-void
.end method

.method private d(F)V
    .locals 3

    .line 3
    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->R:F

    cmpl-float v0, p1, v0

    if-eqz v0, :cond_0

    .line 4
    iput p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->R:F

    .line 5
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v0}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->d()F

    move-result v0

    .line 6
    iget v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->P:I

    if-lez v1, :cond_0

    cmpl-float v1, v0, p1

    if-eqz v1, :cond_0

    .line 7
    iget v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->h:I

    int-to-float v2, v1

    div-float/2addr v2, v0

    float-to-int v0, v2

    int-to-float v1, v1

    div-float/2addr v1, p1

    float-to-int p1, v1

    invoke-direct {p0, v0, p1}, Lcom/google/android/exoplayer/audio/AudioTrack;->a(II)V

    .line 8
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->J:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I

    move-result p1

    iput p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->P:I

    const/4 p1, -0x1

    .line 9
    iput p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->L:I

    :cond_0
    return-void
.end method

.method private l()V
    .locals 5
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/google/android/exoplayer/audio/AudioTrack$InitializationException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-virtual {v0}, Landroid/media/AudioTrack;->getState()I

    move-result v0

    const/4 v1, 0x1

    if-ne v0, v1, :cond_0

    return-void

    :cond_0
    const/4 v1, 0x0

    .line 2
    :try_start_0
    iget-object v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-virtual {v2}, Landroid/media/AudioTrack;->release()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    goto :goto_0

    :catchall_0
    move-exception v0

    .line 3
    iput-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    .line 4
    throw v0

    .line 5
    :catch_0
    :goto_0
    iput-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    .line 6
    new-instance v1, Lcom/google/android/exoplayer/audio/AudioTrack$InitializationException;

    iget v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->h:I

    iget v3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->i:I

    iget v4, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->n:I

    invoke-direct {v1, v0, v2, v3, v4}, Lcom/google/android/exoplayer/audio/AudioTrack$InitializationException;-><init>(IIII)V

    throw v1
.end method

.method private m()J
    .locals 2

    .line 1
    iget-boolean v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->l:Z

    if-eqz v0, :cond_0

    iget-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->z:J

    goto :goto_0

    :cond_0
    iget-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->y:J

    invoke-direct {p0, v0, v1}, Lcom/google/android/exoplayer/audio/AudioTrack;->c(J)J

    move-result-wide v0

    :goto_0
    return-wide v0
.end method

.method private n()J
    .locals 2

    .line 1
    iget-boolean v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->l:Z

    if-eqz v0, :cond_0

    iget-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->x:J

    goto :goto_0

    :cond_0
    iget-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->w:J

    invoke-direct {p0, v0, v1}, Lcom/google/android/exoplayer/audio/AudioTrack;->c(J)J

    move-result-wide v0

    :goto_0
    return-wide v0
.end method

.method private o()Z
    .locals 1

    .line 1
    invoke-virtual {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->g()Z

    move-result v0

    if-eqz v0, :cond_0

    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->B:I

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    goto :goto_0

    :cond_0
    const/4 v0, 0x0

    :goto_0
    return v0
.end method

.method private p()V
    .locals 17

    move-object/from16 v0, p0

    .line 1
    iget-object v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v1}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->b()J

    move-result-wide v1

    const-wide/16 v3, 0x0

    cmp-long v5, v1, v3

    if-nez v5, :cond_0

    return-void

    .line 2
    :cond_0
    invoke-static {}, Ljava/lang/System;->nanoTime()J

    move-result-wide v5

    const-wide/16 v7, 0x3e8

    div-long/2addr v5, v7

    .line 3
    iget-wide v9, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->s:J

    sub-long v9, v5, v9

    const-wide/16 v11, 0x7530

    const/4 v13, 0x0

    cmp-long v14, v9, v11

    if-ltz v14, :cond_2

    .line 4
    iget-object v9, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->d:[J

    iget v10, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->p:I

    sub-long v11, v1, v5

    aput-wide v11, v9, v10

    add-int/lit8 v10, v10, 0x1

    const/16 v9, 0xa

    .line 5
    rem-int/2addr v10, v9

    iput v10, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->p:I

    .line 6
    iget v10, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->q:I

    if-ge v10, v9, :cond_1

    add-int/lit8 v10, v10, 0x1

    .line 7
    iput v10, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->q:I

    .line 8
    :cond_1
    iput-wide v5, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->s:J

    .line 9
    iput-wide v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->r:J

    const/4 v9, 0x0

    .line 10
    :goto_0
    iget v10, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->q:I

    if-ge v9, v10, :cond_2

    .line 11
    iget-wide v11, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->r:J

    iget-object v14, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->d:[J

    aget-wide v15, v14, v9

    int-to-long v3, v10

    div-long/2addr v15, v3

    add-long/2addr v11, v15

    iput-wide v11, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->r:J

    add-int/lit8 v9, v9, 0x1

    const-wide/16 v3, 0x0

    goto :goto_0

    .line 12
    :cond_2
    invoke-direct/range {p0 .. p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->q()Z

    move-result v3

    if-eqz v3, :cond_3

    return-void

    .line 13
    :cond_3
    iget-wide v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->u:J

    sub-long v3, v5, v3

    const-wide/32 v9, 0x7a120

    cmp-long v11, v3, v9

    if-ltz v11, :cond_b

    .line 14
    iget-object v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v3}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->h()Z

    move-result v3

    iput-boolean v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->t:Z

    const-wide/32 v9, 0x4c4b40

    const-string v4, "AudioTrack"

    if-eqz v3, :cond_9

    .line 15
    iget-object v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v3}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->f()J

    move-result-wide v11

    div-long/2addr v11, v7

    .line 16
    iget-object v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v3}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->e()J

    move-result-wide v14

    .line 17
    iget-wide v7, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->D:J

    cmp-long v3, v11, v7

    if-gez v3, :cond_4

    .line 18
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "audioTimestampUs < resumeSystemTimeUs "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-wide v2, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->D:J

    invoke-virtual {v1, v2, v3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v4, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 19
    iput-boolean v13, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->t:Z

    goto/16 :goto_1

    :cond_4
    sub-long v7, v11, v5

    .line 20
    invoke-static {v7, v8}, Ljava/lang/Math;->abs(J)J

    move-result-wide v7

    const-string v3, ", "

    cmp-long v16, v7, v9

    if-lez v16, :cond_6

    .line 21
    new-instance v7, Ljava/lang/StringBuilder;

    invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

    const-string v8, "Spurious audio timestamp (system clock mismatch): "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v14, v15}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v11, v12}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v5, v6}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v1, v2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 22
    sget-boolean v2, Lcom/google/android/exoplayer/audio/AudioTrack;->T:Z

    if-nez v2, :cond_5

    .line 23
    invoke-static {v4, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 24
    iput-boolean v13, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->t:Z

    goto :goto_1

    .line 25
    :cond_5
    new-instance v2, Lcom/google/android/exoplayer/audio/AudioTrack$InvalidAudioTrackTimestampException;

    invoke-direct {v2, v1}, Lcom/google/android/exoplayer/audio/AudioTrack$InvalidAudioTrackTimestampException;-><init>(Ljava/lang/String;)V

    throw v2

    .line 26
    :cond_6
    invoke-direct {v0, v14, v15}, Lcom/google/android/exoplayer/audio/AudioTrack;->b(J)J

    move-result-wide v7

    sub-long/2addr v7, v1

    invoke-static {v7, v8}, Ljava/lang/Math;->abs(J)J

    move-result-wide v7

    cmp-long v16, v7, v9

    if-lez v16, :cond_8

    .line 27
    new-instance v7, Ljava/lang/StringBuilder;

    invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

    const-string v8, "Spurious audio timestamp (frame position mismatch): "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v14, v15}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v11, v12}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v5, v6}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v7, v1, v2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 28
    sget-boolean v2, Lcom/google/android/exoplayer/audio/AudioTrack;->T:Z

    if-nez v2, :cond_7

    .line 29
    invoke-static {v4, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 30
    iput-boolean v13, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->t:Z

    goto :goto_1

    .line 31
    :cond_7
    new-instance v2, Lcom/google/android/exoplayer/audio/AudioTrack$InvalidAudioTrackTimestampException;

    invoke-direct {v2, v1}, Lcom/google/android/exoplayer/audio/AudioTrack$InvalidAudioTrackTimestampException;-><init>(Ljava/lang/String;)V

    throw v2

    .line 32
    :cond_8
    iget-object v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    .line 33
    invoke-direct {v0, v14, v15}, Lcom/google/android/exoplayer/audio/AudioTrack;->b(J)J

    move-result-wide v7

    sub-long/2addr v7, v1

    .line 34
    invoke-virtual {v3, v7, v8}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->b(J)V

    .line 35
    :cond_9
    :goto_1
    iget-object v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->v:Ljava/lang/reflect/Method;

    if-eqz v1, :cond_a

    iget-boolean v2, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->l:Z

    if-nez v2, :cond_a

    const/4 v2, 0x0

    .line 36
    :try_start_0
    iget-object v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-virtual {v1, v3, v2}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/Integer;

    invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

    move-result v1

    int-to-long v7, v1

    const-wide/16 v11, 0x3e8

    mul-long v7, v7, v11

    iget-wide v11, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->o:J

    sub-long/2addr v7, v11

    iput-wide v7, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->E:J

    const-wide/16 v11, 0x0

    .line 37
    invoke-static {v7, v8, v11, v12}, Ljava/lang/Math;->max(JJ)J

    move-result-wide v7

    iput-wide v7, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->E:J

    cmp-long v1, v7, v9

    if-lez v1, :cond_a

    .line 38
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Ignoring impossibly large audio latency: "

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-wide v7, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->E:J

    invoke-virtual {v1, v7, v8}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v4, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    const-wide/16 v3, 0x0

    .line 39
    iput-wide v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->E:J
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_2

    .line 40
    :catch_0
    iput-object v2, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->v:Ljava/lang/reflect/Method;

    .line 41
    :cond_a
    :goto_2
    iput-wide v5, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->u:J

    :cond_b
    return-void
.end method

.method private q()Z
    .locals 2

    .line 1
    sget v0, Lcom/google/android/exoplayer/util/o;->a:I

    const/16 v1, 0x17

    if-ge v0, v1, :cond_1

    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->k:I

    const/4 v1, 0x5

    if-eq v0, v1, :cond_0

    const/4 v1, 0x6

    if-ne v0, v1, :cond_1

    :cond_0
    const/4 v0, 0x1

    goto :goto_0

    :cond_1
    const/4 v0, 0x0

    :goto_0
    return v0
.end method

.method private r()Z
    .locals 2

    .line 1
    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->q()Z

    move-result v0

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    .line 2
    invoke-virtual {v0}, Landroid/media/AudioTrack;->getPlayState()I

    move-result v0

    const/4 v1, 0x2

    if-ne v0, v1, :cond_0

    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    .line 3
    invoke-virtual {v0}, Landroid/media/AudioTrack;->getPlaybackHeadPosition()I

    move-result v0

    if-nez v0, :cond_0

    const/4 v0, 0x1

    goto :goto_0

    :cond_0
    const/4 v0, 0x0

    :goto_0
    return v0
.end method

.method private s()V
    .locals 3

    .line 1
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->f:Landroid/media/AudioTrack;

    if-nez v0, :cond_0

    return-void

    :cond_0
    const/4 v1, 0x0

    .line 2
    iput-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->f:Landroid/media/AudioTrack;

    .line 3
    new-instance v1, Lcom/google/android/exoplayer/audio/AudioTrack$b;

    const-string v2, "AudioTrack Release"

    invoke-direct {v1, p0, v2, v0}, Lcom/google/android/exoplayer/audio/AudioTrack$b;-><init>(Lcom/google/android/exoplayer/audio/AudioTrack;Ljava/lang/String;Landroid/media/AudioTrack;)V

    .line 4
    invoke-virtual {v1}, Ljava/lang/Thread;->start()V

    return-void
.end method

.method private t()V
    .locals 3

    const-wide/16 v0, 0x0

    .line 1
    iput-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->r:J

    const/4 v2, 0x0

    .line 2
    iput v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->q:I

    .line 3
    iput v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->p:I

    .line 4
    iput-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->s:J

    .line 5
    iput-boolean v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->t:Z

    .line 6
    iput-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->u:J

    return-void
.end method

.method private u()V
    .locals 1

    .line 1
    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->F:F

    invoke-direct {p0, v0}, Lcom/google/android/exoplayer/audio/AudioTrack;->c(F)V

    return-void
.end method

.method private v()V
    .locals 1

    .line 1
    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->Q:F

    invoke-virtual {p0, v0}, Lcom/google/android/exoplayer/audio/AudioTrack;->a(F)V

    return-void
.end method


# virtual methods
.method public a()I
    .locals 1

    .line 59
    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->n:I

    return v0
.end method

.method public a(I)I
    .locals 10
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/google/android/exoplayer/audio/AudioTrack$InitializationException;
        }
    .end annotation

    .line 44
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->c:Landroid/os/ConditionVariable;

    invoke-virtual {v0}, Landroid/os/ConditionVariable;->block()V

    if-nez p1, :cond_0

    .line 45
    new-instance v7, Landroid/media/AudioTrack;

    iget v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->b:I

    iget v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->h:I

    iget v3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->i:I

    iget v4, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->k:I

    iget v5, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->n:I

    const/4 v6, 0x1

    move-object v0, v7

    invoke-direct/range {v0 .. v6}, Landroid/media/AudioTrack;-><init>(IIIIII)V

    iput-object v7, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    goto :goto_0

    .line 46
    :cond_0
    new-instance v0, Landroid/media/AudioTrack;

    iget v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->b:I

    iget v3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->h:I

    iget v4, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->i:I

    iget v5, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->k:I

    iget v6, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->n:I

    const/4 v7, 0x1

    move-object v1, v0

    move v8, p1

    invoke-direct/range {v1 .. v8}, Landroid/media/AudioTrack;-><init>(IIIIIII)V

    iput-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    .line 47
    :goto_0
    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->l()V

    .line 48
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-virtual {v0}, Landroid/media/AudioTrack;->getAudioSessionId()I

    move-result v0

    .line 49
    sget-boolean v1, Lcom/google/android/exoplayer/audio/AudioTrack;->S:Z

    if-eqz v1, :cond_2

    .line 50
    sget v1, Lcom/google/android/exoplayer/util/o;->a:I

    const/16 v2, 0x15

    if-ge v1, v2, :cond_2

    .line 51
    iget-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->f:Landroid/media/AudioTrack;

    if-eqz v1, :cond_1

    .line 52
    invoke-virtual {v1}, Landroid/media/AudioTrack;->getAudioSessionId()I

    move-result v1

    if-eq v0, v1, :cond_1

    .line 53
    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->s()V

    .line 54
    :cond_1
    iget-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->f:Landroid/media/AudioTrack;

    if-nez v1, :cond_2

    const/16 v3, 0xfa0

    const/4 v4, 0x4

    const/4 v5, 0x2

    const/4 v6, 0x2

    .line 55
    new-instance v9, Landroid/media/AudioTrack;

    iget v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->b:I

    const/4 v7, 0x0

    move-object v1, v9

    move v8, v0

    invoke-direct/range {v1 .. v8}, Landroid/media/AudioTrack;-><init>(IIIIIII)V

    iput-object v9, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->f:Landroid/media/AudioTrack;

    .line 56
    :cond_2
    iget-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    iget-object v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->q()Z

    move-result v3

    invoke-virtual {v1, v2, v3}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->a(Landroid/media/AudioTrack;Z)V

    .line 57
    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->u()V

    .line 58
    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->v()V

    return v0
.end method

.method public a(Ljava/nio/ByteBuffer;IIJ)I
    .locals 17
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/google/android/exoplayer/audio/AudioTrack$WriteException;
        }
    .end annotation

    move-object/from16 v0, p0

    move/from16 v1, p3

    move-wide/from16 v2, p4

    const/4 v4, 0x2

    if-nez v1, :cond_0

    return v4

    .line 81
    :cond_0
    invoke-direct/range {p0 .. p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->q()Z

    move-result v5

    const-wide/16 v6, 0x0

    const/4 v8, 0x1

    const/4 v9, 0x0

    if-eqz v5, :cond_2

    .line 82
    iget-object v5, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-virtual {v5}, Landroid/media/AudioTrack;->getPlayState()I

    move-result v5

    if-ne v5, v4, :cond_1

    return v9

    .line 83
    :cond_1
    iget-object v5, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-virtual {v5}, Landroid/media/AudioTrack;->getPlayState()I

    move-result v5

    if-ne v5, v8, :cond_2

    iget-object v5, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    .line 84
    invoke-virtual {v5}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->a()J

    move-result-wide v10

    cmp-long v5, v10, v6

    if-eqz v5, :cond_2

    return v9

    .line 85
    :cond_2
    iget v5, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->I:I

    if-nez v5, :cond_3

    .line 86
    iput v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->I:I

    .line 87
    :cond_3
    iget v5, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->P:I

    const/16 v10, 0x15

    if-nez v5, :cond_f

    .line 88
    iget v5, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->I:I

    sub-int v5, v1, v5

    add-int v5, p2, v5

    move-object/from16 v11, p1

    .line 89
    invoke-virtual {v11, v5}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer;

    .line 90
    invoke-direct/range {p0 .. p1}, Lcom/google/android/exoplayer/audio/AudioTrack;->a(Ljava/nio/ByteBuffer;)I

    move-result v12

    iput v12, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->P:I

    .line 91
    invoke-virtual/range {p1 .. p1}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v12

    iput v12, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->I:I

    .line 92
    iget v12, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->P:I

    if-nez v12, :cond_6

    .line 93
    iget v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->B:I

    if-nez v1, :cond_4

    .line 94
    invoke-static {v6, v7, v2, v3}, Ljava/lang/Math;->max(JJ)J

    move-result-wide v1

    iput-wide v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->C:J

    .line 95
    iput v8, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->B:I

    .line 96
    :cond_4
    iget-boolean v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->l:Z

    if-nez v1, :cond_5

    .line 97
    iget-wide v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->y:J

    invoke-virtual/range {p1 .. p1}, Ljava/nio/ByteBuffer;->position()I

    move-result v3

    sub-int/2addr v3, v5

    int-to-long v5, v3

    add-long/2addr v1, v5

    iput-wide v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->y:J

    :cond_5
    return v4

    .line 98
    :cond_6
    iget-object v13, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->O:Ljava/nio/ByteBuffer;

    invoke-direct {v0, v13, v9, v12}, Lcom/google/android/exoplayer/audio/AudioTrack;->a(Ljava/nio/ByteBuffer;II)V

    .line 99
    iget-boolean v12, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->l:Z

    if-eqz v12, :cond_7

    iget v12, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->A:I

    if-nez v12, :cond_7

    .line 100
    iget v12, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->k:I

    iget-object v13, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->J:Ljava/nio/ByteBuffer;

    invoke-static {v12, v13}, Lcom/google/android/exoplayer/audio/AudioTrack;->a(ILjava/nio/ByteBuffer;)I

    move-result v12

    iput v12, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->A:I

    .line 101
    :cond_7
    iget v12, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->B:I

    if-nez v12, :cond_8

    .line 102
    invoke-static {v6, v7, v2, v3}, Ljava/lang/Math;->max(JJ)J

    move-result-wide v2

    iput-wide v2, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->C:J

    .line 103
    iput v8, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->B:I

    goto :goto_0

    .line 104
    :cond_8
    iget-wide v6, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->C:J

    invoke-direct/range {p0 .. p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->m()J

    move-result-wide v12

    invoke-direct {v0, v12, v13}, Lcom/google/android/exoplayer/audio/AudioTrack;->b(J)J

    move-result-wide v12

    add-long/2addr v6, v12

    .line 105
    iget v12, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->B:I

    if-ne v12, v8, :cond_9

    sub-long v12, v6, v2

    .line 106
    invoke-static {v12, v13}, Ljava/lang/Math;->abs(J)J

    move-result-wide v12

    const-wide/32 v14, 0x30d40

    cmp-long v16, v12, v14

    if-lez v16, :cond_9

    .line 107
    new-instance v12, Ljava/lang/StringBuilder;

    invoke-direct {v12}, Ljava/lang/StringBuilder;-><init>()V

    const-string v13, "Discontinuity detected [expected "

    invoke-virtual {v12, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v12, v6, v7}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string v13, ", got "

    invoke-virtual {v12, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v12, v2, v3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string v13, "]"

    invoke-virtual {v12, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v12}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v12

    const-string v13, "AudioTrack"

    invoke-static {v13, v12}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 108
    iput v4, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->B:I

    .line 109
    :cond_9
    iget v12, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->B:I

    if-ne v12, v4, :cond_a

    .line 110
    iget-wide v12, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->C:J

    sub-long/2addr v2, v6

    add-long/2addr v12, v2

    iput-wide v12, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->C:J

    .line 111
    iput v8, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->B:I

    goto :goto_1

    :cond_a
    :goto_0
    const/4 v8, 0x0

    .line 112
    :goto_1
    sget v2, Lcom/google/android/exoplayer/util/o;->a:I

    if-ge v2, v10, :cond_d

    .line 113
    iget-object v2, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->G:[B

    if-eqz v2, :cond_b

    array-length v2, v2

    if-ge v2, v1, :cond_c

    .line 114
    :cond_b
    new-array v2, v1, [B

    iput-object v2, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->G:[B

    .line 115
    :cond_c
    iget-object v2, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->J:Ljava/nio/ByteBuffer;

    iget-object v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->G:[B

    invoke-virtual {v2, v3, v9, v1}, Ljava/nio/ByteBuffer;->get([BII)Ljava/nio/ByteBuffer;

    .line 116
    iput v9, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->H:I

    .line 117
    :cond_d
    iget-boolean v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->l:Z

    if-eqz v1, :cond_e

    .line 118
    iget-wide v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->z:J

    long-to-float v1, v1

    iget v2, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->A:I

    int-to-float v2, v2

    iget-object v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v3}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->d()F

    move-result v3

    mul-float v2, v2, v3

    add-float/2addr v1, v2

    float-to-long v1, v1

    iput-wide v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->z:J

    goto :goto_2

    .line 119
    :cond_e
    iget-wide v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->y:J

    invoke-virtual/range {p1 .. p1}, Ljava/nio/ByteBuffer;->position()I

    move-result v3

    sub-int/2addr v3, v5

    int-to-long v3, v3

    add-long/2addr v1, v3

    iput-wide v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->y:J

    goto :goto_2

    :cond_f
    const/4 v8, 0x0

    .line 120
    :goto_2
    sget v1, Lcom/google/android/exoplayer/util/o;->a:I

    if-ge v1, v10, :cond_10

    .line 121
    iget-wide v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->w:J

    iget-object v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    .line 122
    invoke-virtual {v3}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->a()J

    move-result-wide v3

    iget v5, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->m:I

    int-to-long v5, v5

    mul-long v3, v3, v5

    sub-long/2addr v1, v3

    long-to-int v2, v1

    .line 123
    iget v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->n:I

    sub-int/2addr v1, v2

    if-lez v1, :cond_11

    .line 124
    iget v2, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->P:I

    invoke-static {v2, v1}, Ljava/lang/Math;->min(II)I

    move-result v1

    .line 125
    iget-object v2, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    iget-object v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->G:[B

    iget v4, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->H:I

    invoke-virtual {v2, v3, v4, v1}, Landroid/media/AudioTrack;->write([BII)I

    move-result v9

    if-ltz v9, :cond_11

    .line 126
    iget v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->H:I

    add-int/2addr v1, v9

    iput v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->H:I

    goto :goto_3

    .line 127
    :cond_10
    iget-object v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    iget-object v2, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->J:Ljava/nio/ByteBuffer;

    iget v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->P:I

    invoke-static {v1, v2, v3}, Lcom/google/android/exoplayer/audio/AudioTrack;->a(Landroid/media/AudioTrack;Ljava/nio/ByteBuffer;I)I

    move-result v9

    :cond_11
    :goto_3
    if-ltz v9, :cond_15

    .line 128
    iget v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->P:I

    sub-int/2addr v1, v9

    iput v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->P:I

    .line 129
    iget-boolean v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->l:Z

    if-nez v1, :cond_12

    .line 130
    iget-wide v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->w:J

    long-to-float v1, v1

    int-to-float v2, v9

    iget-object v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v3}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->d()F

    move-result v3

    mul-float v2, v2, v3

    add-float/2addr v1, v2

    float-to-long v1, v1

    iput-wide v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->w:J

    .line 131
    :cond_12
    iget v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->I:I

    if-nez v1, :cond_14

    .line 132
    iget-boolean v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->l:Z

    if-eqz v1, :cond_13

    .line 133
    iget-wide v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->x:J

    long-to-float v1, v1

    iget v2, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->A:I

    int-to-float v2, v2

    iget-object v3, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v3}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->d()F

    move-result v3

    mul-float v2, v2, v3

    add-float/2addr v1, v2

    float-to-long v1, v1

    iput-wide v1, v0, Lcom/google/android/exoplayer/audio/AudioTrack;->x:J

    :cond_13
    or-int/lit8 v8, v8, 0x2

    :cond_14
    return v8

    .line 134
    :cond_15
    new-instance v1, Lcom/google/android/exoplayer/audio/AudioTrack$WriteException;

    invoke-direct {v1, v9}, Lcom/google/android/exoplayer/audio/AudioTrack$WriteException;-><init>(I)V

    throw v1
.end method

.method public a(Z)J
    .locals 6

    .line 4
    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->o()Z

    move-result v0

    if-nez v0, :cond_0

    const-wide/high16 v0, -0x8000000000000000L

    return-wide v0

    .line 5
    :cond_0
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-virtual {v0}, Landroid/media/AudioTrack;->getPlayState()I

    move-result v0

    const/4 v1, 0x3

    if-ne v0, v1, :cond_1

    .line 6
    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->p()V

    .line 7
    :cond_1
    invoke-static {}, Ljava/lang/System;->nanoTime()J

    move-result-wide v0

    const-wide/16 v2, 0x3e8

    div-long/2addr v0, v2

    .line 8
    iget-boolean v4, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->t:Z

    if-eqz v4, :cond_2

    .line 9
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {p1}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->f()J

    move-result-wide v4

    div-long/2addr v4, v2

    sub-long/2addr v0, v4

    long-to-float p1, v0

    .line 10
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    .line 11
    invoke-virtual {v0}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->c()F

    move-result v0

    mul-float p1, p1, v0

    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v0}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->d()F

    move-result v0

    mul-float p1, p1, v0

    float-to-long v0, p1

    .line 12
    invoke-direct {p0, v0, v1}, Lcom/google/android/exoplayer/audio/AudioTrack;->a(J)J

    move-result-wide v0

    .line 13
    iget-object p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {p1}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->e()J

    move-result-wide v2

    add-long/2addr v2, v0

    .line 14
    invoke-direct {p0, v2, v3}, Lcom/google/android/exoplayer/audio/AudioTrack;->b(J)J

    move-result-wide v0

    iget-wide v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->C:J

    add-long/2addr v0, v2

    goto :goto_1

    .line 15
    :cond_2
    iget v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->q:I

    if-nez v2, :cond_3

    .line 16
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v0}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->b()J

    move-result-wide v0

    iget-wide v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->C:J

    goto :goto_0

    .line 17
    :cond_3
    iget-wide v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->r:J

    add-long/2addr v0, v2

    iget-wide v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->C:J

    :goto_0
    add-long/2addr v0, v2

    if-nez p1, :cond_4

    .line 18
    iget-wide v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->E:J

    sub-long/2addr v0, v2

    :cond_4
    :goto_1
    return-wide v0
.end method

.method public a(F)V
    .locals 1

    .line 137
    iput p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->Q:F

    .line 138
    invoke-virtual {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->g()Z

    move-result v0

    if-nez v0, :cond_0

    const-string p1, "AudioTrack"

    const-string v0, "setPlaybackSpeed isInitialized"

    .line 139
    invoke-static {p1, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 140
    :cond_0
    :try_start_0
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v0, p1}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->a(F)V

    const/high16 v0, 0x3f800000    # 1.0f

    .line 141
    invoke-direct {p0, v0}, Lcom/google/android/exoplayer/audio/AudioTrack;->d(F)V
    :try_end_0
    .catch Ljava/lang/UnsupportedOperationException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 142
    :catch_0
    invoke-direct {p0, p1}, Lcom/google/android/exoplayer/audio/AudioTrack;->d(F)V

    :goto_0
    return-void
.end method

.method public a(Landroid/media/MediaFormat;Z)V
    .locals 1

    const/4 v0, 0x0

    .line 19
    invoke-virtual {p0, p1, p2, v0}, Lcom/google/android/exoplayer/audio/AudioTrack;->a(Landroid/media/MediaFormat;ZI)V

    return-void
.end method

.method public a(Landroid/media/MediaFormat;ZI)V
    .locals 8

    const-string v0, "channel-count"

    .line 20
    invoke-virtual {p1, v0}, Landroid/media/MediaFormat;->getInteger(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->j:I

    packed-switch v0, :pswitch_data_0

    .line 21
    new-instance p1, Ljava/lang/IllegalArgumentException;

    new-instance p2, Ljava/lang/StringBuilder;

    invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V

    const-string p3, "Unsupported channel count: "

    invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget p3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->j:I

    invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p2

    invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw p1

    .line 22
    :pswitch_0
    sget v0, Lcom/google/android/exoplayer/b;->a:I

    goto :goto_0

    :pswitch_1
    const/16 v0, 0x4fc

    goto :goto_0

    :pswitch_2
    const/16 v0, 0xfc

    goto :goto_0

    :pswitch_3
    const/16 v0, 0xdc

    goto :goto_0

    :pswitch_4
    const/16 v0, 0xcc

    goto :goto_0

    :pswitch_5
    const/16 v0, 0x1c

    goto :goto_0

    :pswitch_6
    const/16 v0, 0xc

    goto :goto_0

    :pswitch_7
    const/4 v0, 0x4

    :goto_0
    const-string v1, "sample-rate"

    .line 23
    invoke-virtual {p1, v1}, Landroid/media/MediaFormat;->getInteger(Ljava/lang/String;)I

    move-result v1

    const-string v2, "mime"

    .line 24
    invoke-virtual {p1, v2}, Landroid/media/MediaFormat;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    const/4 v2, 0x2

    if-eqz p2, :cond_0

    .line 25
    invoke-static {p1}, Lcom/google/android/exoplayer/audio/AudioTrack;->b(Ljava/lang/String;)I

    move-result p1

    goto :goto_1

    :cond_0
    const/4 p1, 0x2

    .line 26
    :goto_1
    invoke-virtual {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->g()Z

    move-result v3

    if-eqz v3, :cond_1

    iget v3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->h:I

    if-ne v3, v1, :cond_1

    iget v3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->i:I

    if-ne v3, v0, :cond_1

    iget v3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->k:I

    if-ne v3, p1, :cond_1

    return-void

    .line 27
    :cond_1
    invoke-virtual {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->k()V

    .line 28
    iput p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->k:I

    .line 29
    iput-boolean p2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->l:Z

    .line 30
    iput v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->h:I

    .line 31
    iput v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->i:I

    .line 32
    iget v3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->j:I

    mul-int/lit8 v3, v3, 0x2

    iput v3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->m:I

    if-eqz p3, :cond_2

    .line 33
    iput p3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->n:I

    goto :goto_5

    :cond_2
    if-eqz p2, :cond_5

    const/4 p3, 0x5

    if-eq p1, p3, :cond_4

    const/4 p3, 0x6

    if-ne p1, p3, :cond_3

    goto :goto_2

    :cond_3
    const p1, 0xc000

    .line 34
    iput p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->n:I

    goto :goto_5

    :cond_4
    :goto_2
    const/16 p1, 0x5000

    .line 35
    iput p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->n:I

    goto :goto_5

    .line 36
    :cond_5
    invoke-static {v1, v0, p1}, Landroid/media/AudioTrack;->getMinBufferSize(III)I

    move-result p1

    const/4 p3, -0x2

    if-eq p1, p3, :cond_6

    const/4 p3, 0x1

    goto :goto_3

    :cond_6
    const/4 p3, 0x0

    .line 37
    :goto_3
    invoke-static {p3}, Lcom/google/android/exoplayer/util/b;->b(Z)V

    mul-int/lit8 p3, p1, 0x4

    const-wide/32 v0, 0x3d090

    .line 38
    invoke-direct {p0, v0, v1}, Lcom/google/android/exoplayer/audio/AudioTrack;->a(J)J

    move-result-wide v0

    long-to-int v1, v0

    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->m:I

    mul-int v1, v1, v0

    int-to-long v2, p1

    const-wide/32 v4, 0xb71b0

    .line 39
    invoke-direct {p0, v4, v5}, Lcom/google/android/exoplayer/audio/AudioTrack;->a(J)J

    move-result-wide v4

    iget p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->m:I

    int-to-long v6, p1

    mul-long v4, v4, v6

    .line 40
    invoke-static {v2, v3, v4, v5}, Ljava/lang/Math;->max(JJ)J

    move-result-wide v2

    long-to-int p1, v2

    if-ge p3, v1, :cond_7

    move p3, v1

    goto :goto_4

    :cond_7
    if-le p3, p1, :cond_8

    move p3, p1

    .line 41
    :cond_8
    :goto_4
    iput p3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->n:I

    :goto_5
    if-eqz p2, :cond_9

    const-wide/16 p1, -0x1

    goto :goto_6

    .line 42
    :cond_9
    iget p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->n:I

    int-to-long p1, p1

    .line 43
    invoke-direct {p0, p1, p2}, Lcom/google/android/exoplayer/audio/AudioTrack;->c(J)J

    move-result-wide p1

    invoke-direct {p0, p1, p2}, Lcom/google/android/exoplayer/audio/AudioTrack;->b(J)J

    move-result-wide p1

    :goto_6
    iput-wide p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->o:J

    return-void

    nop

    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_7
        :pswitch_6
        :pswitch_5
        :pswitch_4
        :pswitch_3
        :pswitch_2
        :pswitch_1
        :pswitch_0
    .end packed-switch
.end method

.method public a(Landroid/media/PlaybackParams;)V
    .locals 1

    .line 136
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v0, p1}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->a(Landroid/media/PlaybackParams;)V

    return-void
.end method

.method public a(Ljava/lang/String;)Z
    .locals 1

    .line 2
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->a:Lcom/google/android/exoplayer/audio/a;

    if-eqz v0, :cond_0

    .line 3
    invoke-static {p1}, Lcom/google/android/exoplayer/audio/AudioTrack;->b(Ljava/lang/String;)I

    move-result p1

    invoke-virtual {v0, p1}, Lcom/google/android/exoplayer/audio/a;->a(I)Z

    move-result p1

    if-eqz p1, :cond_0

    const/4 p1, 0x1

    goto :goto_0

    :cond_0
    const/4 p1, 0x0

    :goto_0
    return p1
.end method

.method public b()J
    .locals 2

    .line 1
    iget-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->o:J

    return-wide v0
.end method

.method public b(F)V
    .locals 1

    .line 16
    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->F:F

    cmpl-float v0, v0, p1

    if-eqz v0, :cond_0

    .line 17
    iput p1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->F:F

    .line 18
    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->u()V

    :cond_0
    return-void
.end method

.method public c()V
    .locals 2

    .line 1
    iget v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->B:I

    const/4 v1, 0x1

    if-ne v0, v1, :cond_0

    const/4 v0, 0x2

    .line 2
    iput v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->B:I

    :cond_0
    return-void
.end method

.method public d()V
    .locals 3

    .line 1
    invoke-virtual {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->g()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 2
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->n()J

    move-result-wide v1

    invoke-virtual {v0, v1, v2}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->a(J)V

    :cond_0
    return-void
.end method

.method public e()Z
    .locals 5

    .line 1
    invoke-virtual {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->g()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 2
    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->n()J

    move-result-wide v0

    iget-object v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v2}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->a()J

    move-result-wide v2

    cmp-long v4, v0, v2

    if-gtz v4, :cond_0

    .line 3
    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->r()Z

    move-result v0

    if-eqz v0, :cond_1

    :cond_0
    const/4 v0, 0x1

    goto :goto_0

    :cond_1
    const/4 v0, 0x0

    :goto_0
    return v0
.end method

.method public f()I
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/google/android/exoplayer/audio/AudioTrack$InitializationException;
        }
    .end annotation

    const/4 v0, 0x0

    .line 1
    invoke-virtual {p0, v0}, Lcom/google/android/exoplayer/audio/AudioTrack;->a(I)I

    move-result v0

    return v0
.end method

.method public g()Z
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    goto :goto_0

    :cond_0
    const/4 v0, 0x0

    :goto_0
    return v0
.end method

.method public h()V
    .locals 1

    .line 1
    invoke-virtual {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->g()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 2
    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->t()V

    .line 3
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v0}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->g()V

    :cond_0
    return-void
.end method

.method public i()V
    .locals 4

    .line 1
    invoke-virtual {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->g()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 2
    invoke-static {}, Ljava/lang/System;->nanoTime()J

    move-result-wide v0

    const-wide/16 v2, 0x3e8

    div-long/2addr v0, v2

    iput-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->D:J

    .line 3
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-virtual {v0}, Landroid/media/AudioTrack;->play()V

    :cond_0
    return-void
.end method

.method public j()V
    .locals 0

    .line 1
    invoke-virtual {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->k()V

    .line 2
    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->s()V

    return-void
.end method

.method public k()V
    .locals 4

    .line 1
    invoke-virtual {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->g()Z

    move-result v0

    if-eqz v0, :cond_2

    const-wide/16 v0, 0x0

    .line 2
    iput-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->w:J

    .line 3
    iput-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->y:J

    .line 4
    iput-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->x:J

    .line 5
    iput-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->z:J

    const/4 v2, 0x0

    .line 6
    iput v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->A:I

    .line 7
    iput v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->I:I

    .line 8
    iput v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->P:I

    .line 9
    iput v2, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->B:I

    .line 10
    iput-wide v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->E:J

    .line 11
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->M:Ljava/nio/ByteBuffer;

    if-eqz v0, :cond_0

    .line 12
    invoke-virtual {v0}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;

    .line 13
    :cond_0
    invoke-direct {p0}, Lcom/google/android/exoplayer/audio/AudioTrack;->t()V

    .line 14
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-virtual {v0}, Landroid/media/AudioTrack;->getPlayState()I

    move-result v0

    const/4 v1, 0x3

    if-ne v0, v1, :cond_1

    .line 15
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    invoke-virtual {v0}, Landroid/media/AudioTrack;->pause()V

    .line 16
    :cond_1
    iget-object v0, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    const/4 v1, 0x0

    .line 17
    iput-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->g:Landroid/media/AudioTrack;

    .line 18
    iget-object v3, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->e:Lcom/google/android/exoplayer/audio/AudioTrack$c;

    invoke-virtual {v3, v1, v2}, Lcom/google/android/exoplayer/audio/AudioTrack$c;->a(Landroid/media/AudioTrack;Z)V

    .line 19
    iget-object v1, p0, Lcom/google/android/exoplayer/audio/AudioTrack;->c:Landroid/os/ConditionVariable;

    invoke-virtual {v1}, Landroid/os/ConditionVariable;->close()V

    .line 20
    new-instance v1, Lcom/google/android/exoplayer/audio/AudioTrack$a;

    const-string v2, "AudioTrack Reset"

    invoke-direct {v1, p0, v2, v0}, Lcom/google/android/exoplayer/audio/AudioTrack$a;-><init>(Lcom/google/android/exoplayer/audio/AudioTrack;Ljava/lang/String;Landroid/media/AudioTrack;)V

    .line 21
    invoke-virtual {v1}, Ljava/lang/Thread;->start()V

    :cond_2
    return-void
.end method
